package com.detoandy.controller;

import com.detoandy.model.Blog;
import com.detoandy.service.BloggerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

/**
 * Created by zhengdt on 2017/8/21.
 */
@Controller
public class BloggerController {

    @Autowired
    private BloggerService bloggerService;

    @GetMapping("/")
    public String index(ModelMap model) {
        List<Blog> blogList = bloggerService.getAllBlog();
        model.addAttribute("blogList",blogList);
        return "index";
    }
}
